﻿<?xml version="1.0" encoding="UTF-8"?>

<!--
   Sphinx-4 Configuration file
-->

<!-- ******************************************************** -->
<!--  tidigits configuration file                             -->
<!-- ******************************************************** -->

<config>

  <!-- ******************************************************** -->
  <!-- frequently tuned properties                              -->
  <!-- ******************************************************** -->

  <property name="absoluteBeamWidth"         value="-1"/>
  <property name="relativeBeamWidth"         value="1E-200"/>
  <property name="wordInsertionProbability"  value="1E-36"/>
  <property name="languageWeight"            value="8"/>
  <property name="silenceInsertionProbability" value="1"/>
  <property name="skip"     value="0"/>

  <property name="linguist"   value="flatLinguist"/>
  <property name="frontend"   value="mfcFrontEnd"/>

  <!-- ******************************************************** -->
  <!-- batch tool configuration                                 -->
  <!-- ******************************************************** -->

  <component name="batch" type="edu.cmu.sphinx.tools.batch.BatchModeRecognizer">
    <property name="recognizer" value="connectedDigitsRecognizer"/>
    <property name="inputSource" value="streamDataSource"/>
    <propertylist name="monitors">
      <item>accuracyTracker </item>
    </propertylist>
  </component>

  <!-- ******************************************************** -->
  <!-- The connectedDigitsRecognizer configuration               -->
  <!-- ******************************************************** -->

  <component name="recognizer" type="Recognizer.Recognizer">
    <property name="decoder" value="digitsDecoder"/>
  </component>
  <!-- ******************************************************** -->
  <!-- The Decoder   configuration                              -->
  <!-- ******************************************************** -->

  <component name="digitsDecoder" type="Decoder.Decoder">
    <property name="searchManager" value="searchManager"/>
  </component>

 


  <component name="searchManager" type="Decoder.Search.SimpleBreadthFirstSearchManager">
    <property name="logMath" value="logMath"/>
    <property name="linguist" value="${linguist}"/>
    <property name="pruner" value="trivialPruner"/>
    <property name="scorer" value="threadedScorer"/>
    <property name="activeListFactory" value="activeList"/>
  </component>


  <component name="activeList"
           type="Decoder.Search.SortingActiveListFactory">
    <property name="logMath" value="logMath"/>
    <property name="absoluteBeamWidth" value="${absoluteBeamWidth}"/>
    <property name="relativeBeamWidth" value="${relativeBeamWidth}"/>
  </component>

  <component name="trivialPruner"
              type="Decoder.Pruner.SimplePruner"/>
  

  <component name="threadedScorer"
              type="Decoder.Scorer.ThreadedAcousticScorer">
    <property name="frontend" value="${frontend}"/>
    <property name="isCpuRelative" value="true"/>
    <property name="numThreads" value="0"/>
    <property name="minScoreablesPerThread" value="10"/>
    <property name="scoreablesKeepFeature" value="true"/>
  </component>

  <!-- ******************************************************** -->
  <!-- The linguist  configuration                              -->
  <!-- ******************************************************** -->

  <component name="flatLinguist" type="Linguist.Flat.FlatLinguist">
    <property name="logMath" value="logMath"/>
    <property name="unitManager" value="unitManager"/>
    <property name="grammar" value="wordListGrammar"/>
    <property name="acousticModel" value="acousticModel"/>
    <property name="wordInsertionProbability"
            value="${wordInsertionProbability}"/>
    <property name="silenceInsertionProbability"
            value="${silenceInsertionProbability}"/>
    <property name="languageWeight" value="${languageWeight}"/>
    <property name="phoneLoopAcousticModel" value="wsj"/>
  </component>

  <!-- ******************************************************** -->
  <!-- The Grammar  configuration                               -->
  <!-- ******************************************************** -->
  <component name="wordListGrammar"
      type="Linguist.Language.Grammar.SimpleWordListGrammar">
    <property name="path" value="./tidigits.wordlist"/>
    <property name="isLooping" value="true"/>
    <property name="dictionary" value="dictionary"/>
    <property name="optimizeGrammar" value="true"/>
    <property name="logMath" value="logMath"/>
  </component>



  <!-- ******************************************************** -->
  <!-- The Dictionary configuration                            -->
  <!-- ******************************************************** -->

  <component name="dictionary" type="Linguist.Dictionary.FullDictionary">
    <property name="location"
            value="file:/lab/speech/sphinx4/data/tidigits_8gau_13dCep_16k_40mel_130Hz_6800Hz.bin.zip"/>
    <property name="dictionaryPath" value= "dictionary"/>
    <property name="fillerPath" value="fillerdict"/>
    <property name="addSilEndingPronunciation" value="false"/>
    <property name="unitManager" value="unitManager"/>
  </component>

  <!-- ******************************************************** -->
  <!-- The acoustic model configuration                         -->
  <!-- ******************************************************** -->
  <component name="acousticModel"
    type="Linguist.Acoustic.Tiedstate.TiedStateAcousticModel">
    <property name="loader" value="sphinx3Loader"/>
    <property name="unitManager" value="unitManager"/>
  </component>


  <component name="sphinx3Loader"
         type="Linguist.Acoustic.Tiedstate.Sphinx3Loader">
    <property name="unitManager" value="unitManager"/>
    <property name="logMath" value="logMath"/>
    <property name="isBinary" value="true"/>
    <property name="location"
            value="tidigits.zip"/>
    <property name="definition_file"
            value="wd_dependent_phone.500.mdef"/>
    <property name="dataLocation"
            value="tidigits"/>
    <property name="properties_file" value="am.props"/>
    <property name="FeatureVectorLength" value="39"/>
  </component>

  <!-- ******************************************************** -->
  <!-- The frontend configuration                               -->
  <!-- ******************************************************** -->

  <component name="mfcFrontEnd" type="FrontEnd.FrontEnd">
    <propertylist name="pipeline">
      <item>audioFileDataSource</item>
      <item>premphasizer</item>
      <item>windower</item>
      <item>fft</item>
      <item>melFilterBank</item>
      <item>dct</item>
      <item>batchCMN</item>
      <item>featureExtraction</item>
    </propertylist>
  </component>


  <component name="premphasizer"
              type="FrontEnd.Filter.Preemphasizer"/>

  <!-- ******************************************************** -->
  <!-- The unit manager configuration                           -->
  <!-- ******************************************************** -->

  <component name="unitManager" type="Linguist.Acoustic.UnitManager">
  </component>


  <component name="windower"
              type="FrontEnd.Window.RaisedCosineWindower">
  </component>

  <component name="fft"
          type="FrontEnd.Transform.DiscreteFourierTransform"/>

  <component name="melFilterBank"
          type="FrontEnd.Frequencywarp.MelFrequencyFilterBank">
  </component>

  <component name="dct"
          type="FrontEnd.Transform.DiscreteCosineTransform"/>

  <component name="batchCMN"
              type="FrontEnd.Feature.BatchCMN"/>

  <component name="featureExtraction"
              type="FrontEnd.Feature.DeltasFeatureExtractor"/>

  <component name="streamDataSource1" type="FrontEnd.Util.StreamDataSource">
    <property name="sampleRate" value="16000"/>
  </component>

  <component name="audioFileDataSource" type="FrontEnd.Util.AudioFileDataSource">
    <property name="bytesPerRead" value="3200"/>
  </component>
  
  <component name="cepstrumSource"
      type="edu.cmu.sphinx.frontend.StreamCepstrumSource">
    <property name="sampleRate" value="16000"/>
  </component>

  <!-- ******************************************************* -->
  <!--  monitors                                               -->
  <!-- ******************************************************* -->

  <component name="accuracyTracker"
              type="edu.cmu.sphinx.instrumentation.AccuracyTracker">
    <property name="recognizer" value="connectedDigitsRecognizer"/>
    <property name="showAlignedResults" value="false"/>
    <property name="showRawResults" value="false"/>
  </component>


  <!-- ******************************************************* -->
  <!--  Miscellaneous components                               -->
  <!-- ******************************************************* -->

  <component name="logMath" type="edu.cmu.sphinx.util.LogMath">
    <property name="logBase" value="1.0001"/>
    <property name="useAddTable" value="true"/>
  </component>

</config>
